package nc.ui.arap.buttonstat;

import nc.ui.arap.actions.DefaultAction;
import nc.ui.arap.engine.AbstractRuntime;
import nc.ui.arap.engine.ExtButtonObject;
import nc.ui.arap.engine.IActionRuntime;
import nc.ui.arap.engine.IButtonStatus;
import nc.ui.arap.global.DjTempletHelper;
import nc.ui.ep.dj.ArapBillWorkPageConst;

public class DjCopyBtnStatLisener extends DefaultAction implements
		IButtonStatus {

	public void updateButtonStatus(ExtButtonObject bo, IActionRuntime runtime) {
		// TODO Auto-generated method stub
		if(null != StatListenerHelper.getDjPanel(runtime)){
			int panelprop = StatListenerHelper.getDjPanel(runtime).getPanelProp();
			if(panelprop == 1 || panelprop == 2 || panelprop == 3 || panelprop == 4){
				bo.setVisible(false);
				return ;
			}
		}
		if (!(runtime instanceof AbstractRuntime))
			return;
		AbstractRuntime runt = (AbstractRuntime) runtime;
		bo.setEnabled(false);
		if (ArapBillWorkPageConst.WORKSTAT_ADJUST == StatListenerHelper.getArapDjPanel(runt).getM_DjState() 
				|| DjTempletHelper.isCardInEdit((runt))) {
			return;
		}
		if(null!=runt.getDjDataBuffer().getCurrentDJZBVO()){
			bo.setEnabled(true);
			bo.setVisible(true);
		}
	}

}
